﻿using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shop.Model
{
    public class tradeItem
    {
        [Column(IsPrimary = true, IsIdentity =true)]
        public int id { get; set; }



        /// <summary>
        /// 订单编号
        /// </summary>
        [Column(StringLength = 50)]
        public string trade_no { set; get; }


        /// <summary>
        /// 店铺名称
        /// </summary>
        [Column(StringLength = 200)]
        public string shop_name { set; get; }


        /// <summary>
        /// 订单来源
        /// </summary>
        [Column(StringLength =50)]
        public string trade_from { set; get; }


        /// <summary>
        /// 仓库
        /// </summary>
        [Column(StringLength =100)]
        public string warehouse { set; get; }

        /// <summary>
        /// 原始单号
        /// </summary>
        [Column(StringLength = 300)]
        public string src_tids { set; get; }




        /// <summary>
        /// 订单状态
        /// </summary>
        [Column(StringLength =50)]
        public string trade_status { set; get; }


        /// <summary>
        /// 订单类型
        /// </summary>
        [Column(StringLength =50)]
        public string trade_type { set; get; }


        /// <summary> 货到付款 </summary>
        [Column(StringLength =20)]
        public string cash_on_delivery { set; get; }


        /// <summary>
        /// 退款状态
        /// </summary>
        [Column(StringLength =60)]
        public string refund_status { set; get; }


        /// <summary>
        /// 交易时间
        /// </summary>
        public DateTime? trade_time { set; get; }

        /// <summary>
        /// 付款时间
        /// </summary>
        public DateTime? pay_time { set; get; }



        /// <summary> 发货时间 </summary>
        public DateTime? consign_time { set; get; }


        /// <summary>
        /// 客户网名
        /// </summary>
        [Column(StringLength = 100)]
        public string buyer_nick { set; get; }

        /// <summary>
        /// 收件人
        /// </summary>
        [Column(StringLength = 100)]
        public string receiver_name { set; get; }

        /// <summary>
        /// 收件人地区
        /// 11
        /// 是	收件人的地区,按照城市代码表中对应城市代码进行返回
        /// </summary>
        [Column(StringLength =200)]
        public string receiver_district { set; get; }

        /// <summary>
        /// 地址
        /// 256
        /// 是	地址
        /// </summary>
        [Column(StringLength = 300)]
        public string receiver_address { set; get; }

        /// <summary>
        /// 手机
        /// 40
        /// 是	手机
        /// </summary>
        [Column(StringLength = 50)]
        public string receiver_mobile { set; get; }


        /// <summary>
        /// 分销商信息
        /// 40
        /// 是	分销商信息，不同平台单据分销商会存不同格式情况，具体以返回信息为准
        /// </summary>
        [Column(StringLength = 50)]
        public string fenxiao_nick { set; get; }

        /// <summary> 子单原始单号 </summary>
        [Column(StringLength = 50)]
        public string src_tid { set; get; }

        /// <summary> 来源组合装编号 </summary>
        [Column(StringLength =100)]
        public string suit_no { set; get; }



        /// <summary> 收件人电话 </summary>
        [Column(StringLength = 100)]
        public string receiver_phone2 { set; get; }

        /// <summary>
        /// 邮编
        /// </summary>
        [Column(StringLength = 50)]
        public string receiver_zip { set; get; }


        /// <summary>
        /// 区域
        /// </summary>
        [Column(StringLength = 20)]
        public string receiver_ring { set; get; }


        /// <summary>
        /// 物流公司名称
        /// </summary>
        [Column(StringLength = 50)]
        public string logistics_name { set; get; }

        /// <summary>
        /// 物流单号
        /// </summary>
        [Column(StringLength = 50)]
        public string logistics_no { set; get; }

        /// <summary>
        /// 买家留言
        /// </summary>
        [Column(StringLength = 2000)]
        public string buyer_message { set; get; }

        /// <summary>
        /// 客服备注
        /// 1024
        /// 是	客服备注
        /// </summary>
        [Column(StringLength = 2000)]
        public string cs_remark { set; get; }

        /// <summary>
        /// 打印备注
        /// </summary>
        [Column(StringLength = 300)]
        public string print_remark { set; get; }

        /// <summary> 备注 </summary>
        [Column(StringLength = 300)]
        public string remark { set; get; }

        /// <summary> 客服标旗 </summary>
        [Column(StringLength =20)]
        public string cs_flag { set; get; }


        /// <summary> 订单支付金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? paid { set; get; }


        /// <summary> 邮费 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal post_amount { set; get; }

        /// <summary>
        /// 其它费用
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal other_amount { set; get; }


        /// <summary> 订单总优惠 </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal order_amount { set; get; }



        /// <summary> 应收金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? receivable { set; get; }

        /// <summary>
        /// 款到发货金额
        /// 19,4
        /// 是	款到发货金额,paid>=dap_amount才可发货
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal dap_amount { set; get; }


        /// <summary> 货到付款金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? cod_amount { set; get; }

        /// <summary> 订单预估成本 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? trade_calc_cost { set; get; }


        /// <summary> 邮资成本 </summary>
        [Column(StringLength = 50)]
        public decimal post_cost { set; get; }

        /// <summary> 预估重量 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? calc_weight { set; get; }

        /// <summary> 需开发票 </summary>
        [Column(StringLength = 30)]
        public string invoicing_required { set; get; }

        /// <summary>
        /// 发票抬头
        /// </summary>
        [Column(StringLength = 300)]
        public string invoice_title { set; get; }


        /// <summary>
        /// 发票内容
        /// </summary>
        [Column(StringLength = 300)]
        public string invoice_content { set; get; }

        /// <summary>
        /// 业务员
        /// </summary>
        [Column(StringLength =50)]
        public string salesman { set; get; }


        /// <summary>
        /// 审核人
        /// </summary>
        [Column(StringLength =50)]
        public string checker { set; get; }

        /// <summary>
        /// 财审人
        /// </summary>
        [Column(StringLength =50)]
        public string fchecker { set; get; }

        /// <summary>
        /// 商家编码
        /// </summary>
        [Column(StringLength = 50)]
        public string spec_no { set; get; }


        /// <summary>
        /// 货品编号
        /// </summary>
        [Column(StringLength = 50)]
        public string goods_no { set; get; }

        /// <summary>
        /// 货品名称
        /// </summary>
        [Column(StringLength = 300)]
        public string goods_name { set; get; }


        /// <summary> 规格名称 </summary>
        [Column(StringLength = 300)]
        public string spec_name { set; get; }


        /// <summary>
        /// 平台货品名称
        /// </summary>
        [Column(StringLength = 300)]
        public string api_goods_name { set; get; }


        /// <summary>
        /// 平台规格名称
        /// </summary>
        [Column(StringLength = 300)]
        public string api_spec_name { set; get; }


        /// <summary>
        /// 下单数量
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal num { set; get; }


        /// <summary>
        /// 标价
        ///   19,4
        /// 是	销售单价，手工新建时使用货品属性中的“零售价”
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal price { set; get; }


        /// <summary> 货品总优惠 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? discount { set; get; }

        /// <summary> 货品成交价 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal sell_price { set; get; }

        /// <summary>
        /// 分摊后价格
        ///   19,4
        /// 是	进入ERP后再次调整的价格，默认值与order_price一致
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal share_price { set; get; }



        /// <summary>
        /// 折扣  率
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal discount_rate { set; get; }

        /// <summary>
        /// 实发数量
        ///   19,4
        /// 是	实发数量,此数量为发货数量,删除操作等于将此值设置为0
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal actual_num { set; get; }


        /// <summary>
        /// 分摊后总价
        ///   19,4
        /// 是	分摊后合计应收=share_price * num , share_price 是根据share_amount反推的,因此share_price可能有精度损失
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal share_amount { set; get; }

        /// <summary> 退款前支付金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? paid_before_return { set; get; }



        /// <summary> 分摊邮费 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal? share_post { set; get; }


        /// <summary> 单品支付金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal single_goods_paid { set; get; }

        /// <summary>
        /// 佣金
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal commission { set; get; }

        /// <summary> 拆自组合装 </summary>
        [Column(StringLength = 100)]
        public string self_assembly { set; get; }


        /// <summary>
        /// 估重
        /// </summary>
        [Column(Precision = 19, Scale = 4)]
        public decimal weight { set; get; }



        /// <summary>
        /// 赠品方式
        /// 是	是否是赠品 0非赠品 1自动赠送 2手工赠送
        /// </summary>
        [Column(StringLength =30)]
        public string gift_type { set; get; }



        /// <summary>
        /// 证件号码
        /// 是	淘系平台不返回，其他平台正常返回
        /// </summary>
        [Column(StringLength = 50)]
        public string id_card { set; get; }

        /// <summary>
        /// 标记名称
        /// </summary>
        [Column(StringLength = 50)]
        public string flag_name { set; get; }


        /// <summary> 激活时间 </summary>
        [Column(StringLength =50)]
        public string activation_time { set; get; }


        /// <summary>
        /// 平台货品ID
        /// </summary>
        [Column(StringLength = 50)]
        public string platform_goods_id { set; get; }


        /// <summary>
        /// 平台规格ID
        /// </summary>
        [Column(StringLength = 50)]
        public string platform_spec_id { set; get; }


        /// <summary>
        /// 基本单位
        /// </summary>
        [Column(StringLength = 20)]
        public string base_unit { set; get; }

        /// <summary>
        /// 分销原始单号
        /// 255
        /// 是	分销原始单号
        /// </summary>
        [Column(StringLength = 300)]
        public string fenxiao_tid { set; get; }


        /// <summary> 货品简称 </summary>
        [Column(StringLength = 150)]
        public string goods_shot_name { set; get; }



        /// <summary>
        /// 客户编号
        /// </summary>
        [Column(StringLength = 50)]
        public string customer_no { set; get; }


        /// <summary> 分销商编号 </summary>
        [Column(StringLength = 50)]
        public string fenxiao_no { set; get; }


        /// <summary>
        /// 派送时间
        /// </summary>
        [Column(StringLength = 50)]
        public string to_deliver_time { set; get; }


        /// <summary> 运营负责人 </summary>
        [Column(IsIgnore =true)]
        public string Operator { set; get; }

    }


    /// <summary> 查询用的参数 </summary>
    public class tradeItemQueryDto 
    {

        public DateTime begin {  set; get; }
        public DateTime end {  set; get; }

        /// <summary> 使用参数的精确时间 不要再次计算时间了 </summary>
        public bool UseTime { set; get; } = false;

        public string shop_name { set; get; }   

        public string logistics_no { set; get; }    

        public string logistics_name { set; get; }  

        public string warehouse {  set; get; }  

        public string goods_name { set; get; }  

        public string trade_no { set; get; }    

        public string spec_no { set; get; } 

        public string src_tids { set; get; }    


        public string FUser { set; get;}

        public string UserId { set; get; }


        public string Opertaor { set; get; }

        public string platform_goods_id { set; get; }

    }

}
